"""
@author: Leo
@version: 1.0.0
@file: model_resource.py
@time: 2023/11/14 8:58 PM
"""
from import_export import resources
from opencc import opencc

converter = opencc.OpenCC('t2s')


class T2sModelResource(resources.ModelResource):

    def before_import_row(self, row, **kwargs):
        for field in row.keys():
            row[field] = converter.convert(row[field])
